package com.rongke.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.rongke.mapper.RadiotherapyMapper;
import com.rongke.model.Radiotherapy;
import com.rongke.service.RadiotherapyService;

import org.springframework.stereotype.Service;

/**
 * @RadiotherapyServiceImpl
 * @放疗记录ServiceImpl
 * @version : Ver 1.0
 */
@Service
public class RadiotherapyServiceImpl extends ServiceImpl<RadiotherapyMapper, Radiotherapy>
                                                                                          implements
                                                                                          RadiotherapyService {

    @Override
    public List<Radiotherapy> selectByMrId(long mrId) {
        EntityWrapper<Radiotherapy> ew = new EntityWrapper<>();
        ew.eq("medical_record_id", mrId);
        ew.orderBy("start_time");

        return baseMapper.selectList(ew);
    }

    @Override
    public List<Radiotherapy> selectByMrIdAndDate(long mrId, String startDate) {
        EntityWrapper<Radiotherapy> ew = new EntityWrapper<>();
        ew.eq("medical_record_id", mrId);
        ew.ge("start_time", startDate);
        ew.orderBy("start_time", false);

        return baseMapper.selectList(ew);
    }
}
